<template>
	<!-- 我的项目列表 -->
	<view>
		<hx-navbar ref="hxnb" :config="config" />
		<mescroll-body ref="mescrollRef" :fixed="false" @init="mescrollInit" @down="downCallback" @up="upCallback"
			:down="{auto: false, bgColor: '#FFFFFF'}" :up="upOption">
			<view v-for="(item,index) in projectList" :key="index">
				<view class="projct" @click="note(item.orderNum)">
					<view class="flex" style="justify-content: space-between;">
						<h4>{{item.name}}</h4>
						<view class="status">{{item.state}}</view>
					</view>
					<view class="debriefingConcent flex justify-between align-center justify-center"
						style="padding:0 30rpx ;z-index:99;" @tap.stop="godingdan(item)">
						<view class="flex align-center">
							<image v-if="item.avatar!=null" :src="item.avatar" mode="aspectFit"
								style="width: 114rpx;height: 94rpx;border-radius: 5rpx;"></image>
							<view style="margin-left:30rpx;">
								<view style="color: #1E1E1E;font-size: 28rpx;">{{item.name}}</view>
								<view style="font-size: 24rpx;color: rgba(30,30,30,0.3);">
									{{item.area}}m²&nbsp;&nbsp;{{item.style}}
								</view>
							</view>
						</view>
						<view style="font-size: 32rpx;font-weight: 400;color: #167EC1;">查看订单</view>
					</view>
					<view class="flex justify-between" style="line-height: 40rpx;margin-top: 30rpx;">
						<view class="flex" style="align-items: center; justify-content: space-between;">
							<!-- 设计师页面——image -->
							<image style="width:64rpx;height:64rpx" src="../../../static/me/8015.png" mode=""></image>
							<text style="font-size: 28rpx;color: #333333;">笔记</text><text
								style="font-size: 24rpx;margin-left: 58rpx;" v-if="item.hasPublic == -1">未公开笔记</text>
							<text style="font-size: 24rpx;margin-left: 58rpx;" v-if="item.hasPublic == 1">公开笔记</text>
						</view>
						<view style="font-size: 24rpx;" v-if="item.record !=0">{{item.noteCount}}条记录</view>
						<view style="font-size: 24rpx;" v-if="item.record ==0">暂无记录</view>
					</view>
				</view>
			</view>
		</mescroll-body>
	</view>
</template>

<script>
	import MescrollMixin from "@/components/mescroll-uni/mescroll-mixins.js"; //引入滚动
	export default {
		mixins: [MescrollMixin],
		data() {
			return {
				config: {
					title: '我的项目',
					color: '#111111',
					backgroundColor: [1, '#FFFFFF'],
					border: true,
					// #ifdef H5
					backPage: '',
					// #endif
				},
				upOption: {
					auto: false,
					empty: {
						tip: '~ 无更多数据 ~'
					},
					textNoMore: '--没有更多了--',
					noMoreSize: 3,
				},
				projectList: [],
				type: '',
			}
		},
		created() {

		},
		onLoad() {
			this.type = this.$cache.get('type')
			this.quotationList(1, 10)
		},
		onShow() {

		},
		methods: {
			downCallback() {
				this.mescroll.resetUpScroll();
			},
			upCallback(e) {
				this.quotationList(e.num, 10)
			},
			quotationList(num, size) {
				let data = {
					pageNo: num,
					pageSize: size
				}
				if (this.type == 1) {
					// projectList-用户
					this.$api.designerInfoMe(data).then((res) => {
						let arr = [{
							id: -1,
							name: '已取消',
							color: '#096'
						}, {
							id: 0,
							name: '待支付',
							color: '#000'
						}, {
							id: 1,
							name: '设计阶段',
							color: '#057'
						}, {
							id: 2,
							name: '生产阶段',
							color: '#041'
						}, {
							id: 3,
							name: '安装阶段',
							color: '#077'
						}, {
							id: 4,
							name: '项目已完成待评价',
							color: '#453'
						}, {
							id: 5,
							name: '已评价',
							color: '#753'
						}]
						arr.forEach((item, index) => {
							res.data.result.list.forEach((items, indexs) => {
								if (item.id == items.status) {
									items.state = item.name
									items.color = item.color
								}
							})
						})
						if (num == 1) {
							this.projectList = res.data.result.list
						} else {
							this.projectList = this.projectList.concat(res.data.result.list)
						}
						this.mescroll.endBySize(res.data.result.list.length, res.data.total);
					})
				}
			},
			// 项目详情
			note(orderNum) {
				this.$tools.goPageNoAuth('/clientEnd/page/design/notesDetails?orderNum=' + orderNum)
			},
			// 查看订单
			godingdan(e) {
				this.$tools.goPageNoAuth('/clientEnd/page/ordersList/orderDetail?data=' + JSON.stringify(e))
			},
		}
	}
</script>

<style scoped>
	.projct {
		padding: 30rpx;
		margin: 30rpx;
		background-color: #fff;
		border-radius: 20rpx;
	}

	h4 {
		font-size: 36rpx;
		font-family: Noto Sans SC-Regular, Noto Sans SC;
		font-weight: 400;
		color: #333333;
	}

	.status {
		font-size: 28rpx;
		font-family: Noto Sans SC-Regular, Noto Sans SC;
		font-weight: 400;
		line-height: 40rpx;
	}

	.debriefingConcent {
		width: 534rpx;
		height: 126rpx;
		background: rgba(73, 45, 34, 0.05);
		border-radius: 22rpx;
		margin: 58rpx 0;
	}
</style>
